home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / u_man / cat3 / Tcl / exprlong.z / exprlong
Encoding:
Text File  |  1998-10-30  |  6.7 KB  |  133 lines

  1.  
  2.  
  3.  
  4. TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333TTTTccccllll))))                                          TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333TTTTccccllll))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString - evaluate
  10.      an expression
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  14.  
  15.      int
  16.      TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g, _l_o_n_g_P_t_r)
  17.  
  18.      int
  19.      TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee(_i_n_t_e_r_p, _s_t_r_i_n_g, _d_o_u_b_l_e_P_t_r)
  20.  
  21.      int
  22.      TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn(_i_n_t_e_r_p, _s_t_r_i_n_g, _b_o_o_l_e_a_n_P_t_r)
  23.  
  24.      int
  25.      TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g)
  26.  
  27. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  28.      Tcl_Interp   *_i_n_t_e_r_p       (in)      Interpreter in whose context to
  29.                                           evaluate _s_t_r_i_n_g.
  30.  
  31.      char         *_s_t_r_i_n_g       (in)      Expression to be evaluated.  Must be
  32.                                           in writable memory (the expression
  33.                                           parser makes temporary modifications
  34.                                           to the string during parsing, which
  35.                                           it undoes before returning).
  36.  
  37.      long         *_l_o_n_g_P_t_r      (out)     Pointer to location in which to
  38.                                           store the integer value of the
  39.                                           expression.
  40.  
  41.      int          *_d_o_u_b_l_e_P_t_r    (out)     Pointer to location in which to
  42.                                           store the floating-point value of
  43.                                           the expression.
  44.  
  45.      int          *_b_o_o_l_e_a_n_P_t_r   (out)     Pointer to location in which to
  46.                                           store the 0/1 boolean value of the
  47.                                           expression.
  48.  
  49.  
  50. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  51.      These four procedures all evaluate an expression, returning the result in
  52.      one of four different forms.  The expression is given by the _s_t_r_i_n_g
  53.      argument, and it can have any of the forms accepted by the eeeexxxxpppprrrr command.
  54.      The _i_n_t_e_r_p argument refers to an interpreter used to evaluate the
  55.      expression (e.g. for variables and nested Tcl commands) and to return
  56.      error information.  _I_n_t_e_r_p->_r_e_s_u_l_t is assumed to be initialized in the
  57.      standard fashion when any of the procedures are invoked.
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333TTTTccccllll))))                                          TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333TTTTccccllll))))
  71.  
  72.  
  73.  
  74.      For all of these procedures the return value is a standard Tcl result:
  75.      TTTTCCCCLLLL____OOOOKKKK means the expression was successfully evaluated, and TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR
  76.      means that an error occurred while evaluating the expression.  If
  77.      TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR is returned then _i_n_t_e_r_p->_r_e_s_u_l_t will hold a message describing
  78.      the error.  If an error occurs while executing a Tcl command embedded in
  79.      the expression then that error will be returned.
  80.  
  81.      If the expression is successfully evaluated, then its value is returned
  82.      in one of four forms, depending on which procedure is invoked.
  83.      TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg stores an integer value at *_l_o_n_g_P_t_r.  If the expression's
  84.      actual value is a floating-point number, then it is truncated to an
  85.      integer.  If the expression's actual value is a non-numeric string then
  86.      an error is returned.
  87.  
  88.      TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee stores a floating-point value at *_d_o_u_b_l_e_P_t_r.  If the
  89.      expression's actual value is an integer, it is converted to floating-
  90.      point.  If the expression's actual value is a non-numeric string then an
  91.      error is returned.
  92.  
  93.      TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores a 0/1 integer value at *_b_o_o_l_e_a_n_P_t_r.  If the
  94.      expression's actual value is an integer or floating-point number, then
  95.      TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores 0 at *_b_o_o_l_e_a_n_P_t_r if the value was zero and 1
  96.      otherwise.  If the expression's actual value is a non-numeric string then|
  97.      it must be one of the values accepted by TTTTccccllll____GGGGeeeettttBBBBoooooooolllleeeeaaaannnn, such as ``yes'' |
  98.      or ``no'', or else an error occurs.
  99.  
  100.      TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg returns the value of the expression as a string stored in
  101.      _i_n_t_e_r_p->_r_e_s_u_l_t.  If the expression's actual value is an integer then     |
  102.      TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg converts it to a string using sssspppprrrriiiinnnnttttffff with a ``%d''       |
  103.      converter.  If the expression's actual value is a floating-point number, |
  104.      then TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg calls TTTTccccllll____PPPPrrrriiiinnnnttttDDDDoooouuuubbbblllleeee to convert it to a string.
  105.  
  106.  
  107. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  108.      boolean, double, evaluate, expression, integer, string
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.